<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!doctype html>
<html>
<head>
<title>收银平台配置</title>
<%@ include file="../../common/base.jsp" %>
</head>

<body id="body">
<!--head-->
<div id="head">
	<%@ include file="../../common/head.jsp" %>
</div>
<!--head end-->
<!--container-->
<div id="container">
	<div id="pageId" style="display: none;">05-05-03</div>
		<!--sidebar-->
		<%@ include file="../../common/menu.jsp" %>
	    <!--sidebar-->
    <!--main-->
    <div class="main">
    	<div class="location">
        	<a href="${pageContext.request.contextPath}/success">首页</a><span>&gt;</span>系统配置<span>&gt;</span>收银平台配置
        </div>
        <!--content-->
        <div class="content">
        <div class="set_buttons">
            <button type="button" class="btn btn_add" onClick="javascript:showAddCashierPlat()">添加</button>
        </div>
            <div id="tableResult">
            	<table class="table_type1">
	                <thead>
	                    <tr>
	                        <th>序号</th>
	                        <th>收银平台名称</th>
	                        <th>是否允许继续支付</th>
	                        <th>状态</th>
	                        <th>注册时间</th>
	                        <th>操作</th>
	                    </tr>
	                </thead>
	                <tbody id="bodyResult"></tbody>
	            </table>
            </div>
        </div>
        <!--content-->
        <!--foot-->
        <div id="foot">
        	<p>北京掌中彩信息科技有限公司  提供技术支持</p>
        </div>
        <!--foot-->
    </div>
    <!--main-->
</div>
<!--container-->
<!--遮罩层-->
<div id="mask" style="display:none;"></div>
<!--遮罩层-->
<!--弹出框-->
<div id="popBox" style="width:400px; margin-left:-200px;display:none;" class="popSave">
	<h2>添加</h2>
    <a href="javascript:;" class="close" onClick="$(this).parent('#popBox').hide(); $('#mask').hide()"></a>
    <div class="pop_content">
      <ul class="inputInfoList3">
        <li>
          <label>收银平台名称</label>
          <input type="text" onFocus="this.style.border = '1px solid #2A7CCF'" onBlur="addTipContent1('11');this.style.border = '1px solid #D5D5D5'" class="text" id="platNameAdd" value="" maxlength="20"></input>
          <span class="red">*</span>
          <p id="platNameAddTip" style="display: none;" class="zhu_shi_aa_1"></p>
        </li>
        <li>
          <label>是否允许继续支付</label>
          <input type="radio" id="isRepayAdd" name="isRepayAdd" value="0"  checked="checked" onChange="">是
          <input type="radio" id="isRepayAdd" name="isRepayAdd" value="1"  onchange="">否
        </li>
        <li>
          <label>前台回调地址</label>
          <input type="text" onFocus="this.style.border = '1px solid #2A7CCF'" onBlur="addTipContent2('11');this.style.border = '1px solid #D5D5D5'" class="text" id="callBackUrlAdd" value="" maxlength="100"></input>
          <span class="red">*</span>
          <p id="callBackUrlAddTip" style="display: none; "class="zhu_shi_aa_1"></p>
        </li>
        <li>
          <label>后台通知地址</label>
          <input type="text" onFocus="this.style.border = '1px solid #2A7CCF'" onBlur="this.style.border = '1px solid #D5D5D5'" class="text" id="notifyUrlAdd" value="" maxlength="100"></input>
          <p id="notifyUrlAddTip" style="display: none; "class="zhu_shi_aa_1"></p>
        </li>
        <li>
          <label>是否可用</label>
          <select id="enableAdd" name="enableAdd">
	                    <option selected="selected" value="0">可用</option>
	                    <option value="1">不可用</option>
		  </select>
        </li>
        <li>
          <label>关联支付网关</label>
          <span>	
           	<c:forEach items="${payChannelList }" var="payChannel">
           	<c:if test="${payChannel.status==0 }">
           		<em><input class="back_mess" type="checkbox" name="payChannelId" attname="${payChannel.payChannelName }" value="${payChannel.payChannelId }" onblur="addTipContent4('11');"/>${payChannel.payChannelName }</em>
           	</c:if>
			</c:forEach>
          </span>
          <p id="payGateWayTip" style="display: none;"class="zhu_shi_aa_1"></p>
        </li>
      </ul>
    </div>
    <div class="pop_button">
    	<a href="javascript:submitForm('11');">添加</a>
    </div>
</div>
<!--弹出框-->
<div id="popBox" style="width:400px; margin-left:-200px;display:none;" class="popBoxModify">
	<h2>修改</h2>
    <a href="javascript:;" class="close" onClick="$(this).parent('#popBox').hide(); $('#mask').hide()"></a>
    <div class="pop_content">
      <ul class="inputInfoList3">
      <input type="hidden" class="text" id="platIdModify" value=""></input>
        <li>
          <label>收银平台名称</label>
          <input type="text" onFocus="this.style.border = '1px solid #2A7CCF'" onBlur="addTipContent1('12');this.style.border = '1px solid #D5D5D5'" class="text" id="platNameModify" value="" maxlength="20"></input>
          <span class="red">*</span>
          <p id="platNameModifyTip" style="display: none; " class="zhu_shi_aa_1"></p>
        </li>
        <li>
          <label>是否允许继续支付</label>
          <input type="radio" id="isRepayModify" name="isRepayModify" value="0"  onchange="">是
          <input type="radio" id="isRepayModify" name="isRepayModify" value="1"  onchange="">否
        </li>
        <li>
          <label>前台回调地址</label>
          <input type="text" onFocus="this.style.border = '1px solid #2A7CCF'" onBlur="addTipContent2('12');this.style.border = '1px solid #D5D5D5'" class="text" id="callBackUrlModify" value="" maxlength="100"></input>
          <span class="red">*</span>
          <p id="callBackUrlModifyTip" style="display: none; " class="zhu_shi_aa_1"></p>
        </li>
        <li>
          <label>后台通知地址</label>
          <input type="text" onFocus="this.style.border = '1px solid #2A7CCF'" onBlur="this.style.border = '1px solid #D5D5D5'" class="text" id="notifyUrlModify" value="" maxlength="100"></input>
          <p id="notifyUrlModifyTip" style="display: none;" class="zhu_shi_aa_1"></p>
        </li>
        <li>
          <label>是否可用</label>
          <select id="enableModify" name="enableModify">
	                    <option selected="selected" value="0">可用</option>
	                    <option value="1">不可用</option>
		  </select>
        </li>
        <li>
          <label>关联支付网关</label>
          <span id="modifyPay">	
           	<c:forEach items="${payChannelList }" var="payChannel" varStatus="s">
           		<c:if test="${payChannel.status==0 }">
	           		<em><input class="back_mess"  type="checkbox" name="payChannelIdModify" attname="${payChannel.payChannelName }" value="${payChannel.payChannelId }" onblur="addTipContent4('12');"/>${payChannel.payChannelName }</em>
           		</c:if>
			</c:forEach>
          </span>
          <p id="payChannelIdModifyTip" style="display: none;"class="zhu_shi_aa_1"></p>
        </li>
      </ul>
    </div>
    <div class="pop_button">
    	<a href="javascript:submitForm('12');">修改</a>
    </div>
</div>
<div id="popBox" style="width:400px; margin-left:-200px;display:none;" class="popBoxXQ">
	<h2>详情</h2>
    <a href="javascript:;" class="close" onClick="$(this).parent('#popBox').hide(); $('#mask').hide()"></a>
    <div class="pop_content">
      <ul class="inputInfoList3">
        <li>
          <label>收银平台名称</label>
          <input type="text" onFocus="this.style.border = '1px solid #2A7CCF'" onBlur="this.style.border = '1px solid #D5D5D5'" class="text" id="platNameXQ"  value="" disabled="disabled"></input>
        </li>
        <li>
          <label>是否允许继续支付</label>
          <input type="text" onFocus="this.style.border = '1px solid #2A7CCF'" onBlur="this.style.border = '1px solid #D5D5D5'" class="text" id="isRepayXQ" value="" disabled="disabled"></input>
        </li>
        <li>
          <label>前台回调地址</label>
          <input type="text" onFocus="this.style.border = '1px solid #2A7CCF'" onBlur="this.style.border = '1px solid #D5D5D5'" class="text" id="callBackUrlXQ" value="" disabled="disabled"></input>
        </li>
        <li>
          <label>后台通知地址</label>
          <input type="text" onFocus="this.style.border = '1px solid #2A7CCF'" onBlur="this.style.border = '1px solid #D5D5D5'" class="text" id="notifyUrlXQ" value="" disabled="disabled"></input>
        </li>
        <li>
          <label>是否可用</label>
          <input type="text" onFocus="this.style.border = '1px solid #2A7CCF'" onBlur="this.style.border = '1px solid #D5D5D5'" class="text" id="enableXQ" value="" disabled="disabled"></input>
        </li>
        <li>
          <label>关联支付网关</label>
          <c:forEach items="${payChannelList }" var="payChannel" varStatus="s">
           		<c:if test="${payChannel.status==0 }">
	           		<em><input disabled="true" class="back_mess"  type="checkbox" name="payChannelIdDetail" attname="${payChannel.payChannelName }" value="${payChannel.payChannelId }" onblur="addTipContent4('12');"/>${payChannel.payChannelName }</em>
           		</c:if>
			</c:forEach>
        </li>
      </ul>
    </div>
</div>
<script src="${pageContext.request.contextPath}/static/js/basic.js"></script>
<script type="text/javascript">
//加载ajax请求
function loadResult(){
	$("#tableResult").hideLoading();
	$.ajax({
		url:"cashierPlatConfig/queryCashierPlatConfigrList",
		type:"POST",
		beforeSend:function(XMLHttpRequest){
			$("#tableResult").showLoading();
			flagTable = true;
        },
        error:function(XMLHttpRequest, textStatus, errorThrown){
        	prompt.alert("系统错误");
        	$("#tableResult").hideLoading();
        },
        success:function(data){
        	flagTable = false;
        	$("#tableResult").hideLoading();
        	$("#bodyResult").html("");
        	loadTableResult(data);
        	if($("#bodyResult").html() == ''){
        		$("#bodyResult").html("<tr class=\"no_data\"><td colspan=\"14\">没有符合您要查询的数据！</td></tr>");
        		$(".page").hide();
        		if($("#tfoot").html() != null){
            		$("#tfoot").hide();
            	}
        	}else{
        		if($("#tfoot").html() != null){
            		$("#tfoot").show();
            	}
        		// 排序
            	sortFuntion();
        	}
        }
	});
}

// 加载ajax返回结果
function loadTableResult(data){
	var jo = data.json;
	if(jo != '' && jo != null){
		for (var i = 0; i < jo.length; i++) {
			var isRepay = jo[i].isRepay;
			var enable = jo[i].enable;
			var notifyUrl =jo[i].notifyUrl;
			if(notifyUrl == "" || notifyUrl == null){
				notifyUrl="";
			}
			if(isRepay == 0){
				isRepay="允许";
			}else if(isRepay == 1){
				isRepay="不允许";
			}
			var showEnable = "";
			if(enable == 0){
				enable="启用";
				showEnable="禁用";
			}else if(enable == 1){
				enable="禁用";
				showEnable="启用";
			}
			var content = "<tr>"+
	                    	"<td>"+(i+1)+"</td><td>"+jo[i].platName+
	                    	"</td><td>"+isRepay+
	                    	"</td><td>"+enable+
	                    	"</td><td>"+jo[i].createTimeFormat+"</td>"+
	                    	"<td class='operate'>"+
                            "<div class='btn_operate'>"+
                            "<a href='#'>详情</a>"+
                            "<ul>"+
	                    	    "<li><a href='javascript:showXqPlat("+jo[i].platId+",\""+jo[i].platName+"\",\""+isRepay+"\",\""+jo[i].callBackUrl+"\",\""+notifyUrl+"\",\""+enable+"\");'>详情</a></li>"+
		                    	"<li><a href='javascript:modifyStatus("+jo[i].platId+",\""+jo[i].enable+"\");'>"+showEnable+"</a></li>"+
		                    	"<li><a href='javascript:showModify("+jo[i].platId+",\""+jo[i].platName+"\",\""+jo[i].isRepay+"\",\""+jo[i].callBackUrl+"\",\""+jo[i].notifyUrl+"\",\""+jo[i].enable+"\",\""+jo[i].enable+"\");'>修改</a></li>"+
		                    	/* "<li><a href='javascript:del("+jo[i].platId+");'>删除</a></td></li>"+ */
	                    	"</ul>"+
	                        "</div>"+
	                        "</td>"+
	                      "</tr>";
	        $("#bodyResult").append(content);
	        setting();
	    }
	}
}
function setting(){
	//操作鼠标划过
	var $btn_operate=$(".operate .btn_operate").children("a");
	var $operate_list=$(".operate ul");
	$btn_operate.mouseenter(function(){
		$(this).css("visibility","hidden").siblings("ul").show();	
	});
	$operate_list.mouseleave(function(){
		$(this).hide().siblings("a").css("visibility","visible");	
	});
}

function resetPwd(operatorId,loginName){
	prompt.confirm("您确定要重置密码吗?",function(){
			$.ajax({
			   type: "POST",
			   url: "${pageContext.request.contextPath}/operatorManagement/resetPwd",
			   dataType:"json",
			   data: {
				   operatorId:operatorId,
				   loginName:loginName
			   },
			   success: function(data){
			   		prompt.alert(data.msg);
					if (data.errorCode==0) {
						loadResult(1,$("#selItem").val());
					}
			   }
		});	
	});
}
function showXqPlat(platId,platName,isRepay,callBackUrl,notifyUrl,enable){
	$("#platNameXQ").val(platName);
	$("#isRepayXQ").val(isRepay);
	$("#callBackUrlXQ").val(callBackUrl);
	$("#notifyUrlXQ").val(notifyUrl);
	$("#enableXQ").val(enable);
	//$("#pagGatewayXQ").val(enable);
	$("#mask").show();
	$(".popBoxXQ").show();
	queryPayGateWay(platId);
}
function showModify(platId,platName,isRepay,callBackUrl,notifyUrl,enable,enable){
	//var valCheckboxMo=$('input:checkbox[name="payChannelId"]').val();
	/* var valCheckboxMo = $('input:checkbox[name=payChannelId]').serialize();
	var checkboxId = document.getElementsByName('payChannelId');
	var checkboxvalue = new Array();
    for(var i = 0; i < checkboxId.length; i++){
    	alert(checkboxId[i].value);
     }   */
	if(notifyUrl == "null"){
		notifyUrl='';
	}
	$("#platIdModify").val(platId);
	$("#platNameModify").val(platName);
	$("input[name='isRepayModify'][value="+isRepay+"]").attr("checked",true);
	$("#callBackUrlModify").val(callBackUrl);
	$("#notifyUrlModify").val(notifyUrl);
	$("#enableModify").val(enable);
	$("#mask").show();
	$(".popBoxModify").show();
	queryPayGateWay(platId);
}
function showAddCashierPlat(){
	$(".popSave input[type='text']").each(function(i,e){
		$(e).val("");
	});
	$(".popSave select").each(function(i,e){
		$(e).find("option:first").prop("selected", true);
	});
	$("input[name='isRepayAdd']").get(0).checked=true; 
 
	$("input[name='payChannelId']").each(function(i,e){
		$(e).attr("checked",false);
	});
	$("#mask").show();
	$("#popBox").show();
}
function modifyStatus(platId,enable){
	if(enable == "1"){
		enable = "0";
	}else if(enable == "0"){
		enable = "1";
	} 
	prompt.confirm("是否"+(enable=="0"?"启用":"禁用")+"该收银平台？",function(){
			$.ajax({
			   type: "POST",
			   url: "${pageContext.request.contextPath}/cashierPlatConfig/updateStatus",
			   dataType:"json",
			   data: {
				   platId:platId,
				   enable:enable
			   },
			   success: function(data){
			   		prompt.alert(data.msg);
					if (data.errorCode==0) {
						loadResult();
					}
			   }
		});	
	});
}
function del(platId){
	prompt.confirm("您确定要删除吗?",function(){
			$.ajax({
			   type: "POST",
			   url: "${pageContext.request.contextPath}/cashierPlatConfig/deleteCashierPlat",
			   dataType:"json",
			   data: {
				   platId:platId
			   },
			   success: function(data){
			   		prompt.alert(data.msg);
					if (data.errorCode==0) {
						loadResult();
					}
			   }
		});	
	});
}
function submitForm(addOrModify){
	var param = '';
	var saveOrUpdate = '';
	var platId= '';
	var platName= '';
	var isRepay= '';
	var callBackUrl= '';
	var notifyUrl= '';
	var enable= '';
	var valRadio=$('input:radio[name="isRepayAdd"]:checked').val();
	var valRadioModify=$('input:radio[name="isRepayModify"]:checked').val();
	var payGateWay = $("[name=payChannelId]:checkbox").serialize();
	var payGateWayModify = $("[name=payChannelIdModify]:checkbox").serialize();
	if(addOrModify == '11'){
		saveOrUpdate = 'save';
		platName= $("#platNameAdd").val();
		isRepay= valRadio;
		callBackUrl= $("#callBackUrlAdd").val();
		notifyUrl= $("#notifyUrlAdd").val();
		enable= $("#enableAdd").val();
		if(!addTipContent1("11")){
			return;
		}
		if(!addTipContent2("11")){
			return;
		}
		/* if(!addTipContent3("11")){
			return;
		} */
		if(!addTipContent4("11")){
			return;
		}
		param = "&cashierPlat.platName=" + platName + 
		"&cashierPlat.isRepay=" + isRepay +
		"&cashierPlat.callBackUrl=" + callBackUrl+ 
		"&cashierPlat.notifyUrl=" + notifyUrl +
		"&" + payGateWay +
		"&cashierPlat.enable=" + enable;
	}
	if(addOrModify == '12'){
		saveOrUpdate = 'update';
		platId= $("#platIdModify").val();
		platName= $("#platNameModify").val();
		isRepay= valRadioModify;
		callBackUrl= $("#callBackUrlModify").val();
		notifyUrl= $("#notifyUrlModify").val();
		enable= $("#enableModify").val();
		if(!addTipContent1("12")){
			return;
		}
		if(!addTipContent2("12")){
			return;
		}
		/* if(!addTipContent3("12")){
			return;
		} */
		if(!addTipContent4("12")){
			return;
		}
		param = "&cashierPlat.platId=" +platId + 
		"&cashierPlat.platName=" + platName + 
		"&cashierPlat.isRepay=" + isRepay +
		"&cashierPlat.callBackUrl=" + callBackUrl+ 
		"&cashierPlat.notifyUrl=" + notifyUrl +
		"&" + payGateWayModify +
		"&cashierPlat.enable=" + enable;
	}
	
	/* if (enumCode=='') {
		prompt.alert("投注来源编码不能为空");
		return;
	}
	if (enumName=='') {
		prompt.alert("投注来源名称不能为空");
		return;
	} */
	
	
	$.ajax({
		   type: "POST",
		   url: "${pageContext.request.contextPath}/cashierPlatConfig/saveOrUpdateCashierPlat?type="+saveOrUpdate+param,
		   dataType:"json",
		   data: {
			   platId:platId,
			   platName:platName,
			   isRepay:isRepay,
			   callBackUrl:callBackUrl,
			   notifyUrl:notifyUrl,
			   enable:enable,
			   payGateWay:payGateWay
		   },
		   success: function(data){
			   prompt.alert(data.msg);
			   if(data.errorCode == 0){
				   $("#mask").hide();
    			   $("#popBox").hide();
			   }
               if(data.errorCode == 1){
            	   $("#mask").hide();
    			   $("#popBox").hide();
    			   $(".popBoxModify").hide();
			   }
			   
			   loadResult();
			   //location.reload();
		   },
		   error: function(data){
			   $("#mask").show();
			   if(data.errorCode == 1){
    			   $(".popBoxModify").show();
			   }
			   if(data.errorCode == 0){
				   $("#popBox").show();
			   }
			}
	});
}

function queryPayGateWay(platId){
			$.ajax({
			   type: "POST",
			   url: "${pageContext.request.contextPath}/cashierPlatConfig/queryPayGateWay",
			   dataType:"json",
			   data: {
				   platId:platId
			   },
			   success: function(data){
				   var payChecked = data.jsonPart;
				   if(payChecked != '' && payChecked != null){
					   //已配置的支付网关数组
					    var valueArray = new Array();
						for (var i = 0; i < payChecked.length; i++) {
							/* var content = "<em>"+
							"<input class='back_mess' type='checkbox' name='payChannelId' disabled='disabled' checked='true'"+
							"attname='"+payChecked[i].payChannelName + "'"+
							"value='"+payChecked[i].payChannelId + "'"+ " />" + payChecked[i].payChannelName +
							"</em>";
							$("#payGateXQ").append(content); */
							valueArray.push(payChecked[i].payChannelId);
						}
						
						//var checkboxId = document.getElementsByName('payChannelIdModify');
						$("[name^='payChannelId']").each(function(){
							if($.inArray(this.value, valueArray) >= 0){
								this.checked =true;
							}else {
								this.checked =false;
							}
						});
						
						
					    /* for(var j = 0; j < checkboxId.length; j++){
					    	//alert(checkboxId[j].value);
					    	//alert(valueArray);
					    	 if($.inArray(checkboxId[j].value, valueArray) >= 0){
					    		//$("[value="+checkboxId[j].value+"]:checkbox").attr('checked',true);
					    		$("[name=payChannelIdModify]:checkbox").attr('checked',true);
					    		//$(this).attr('checked', true);
					    	} 
					    	$("[name=payChannelIdModify]").each(function(){
								if($.inArray(checkboxId[j].value, valueArray) >= 0){
									$(this).attr('checked', true);
								}
							});
					     } */
					}
			   }
		});	
}

function addTipContent1(addOrModify){
	var platName= '';
	$("#platNameAddTip").hide();
	$("#platNameAddTip").html("");
	$("#platNameModifyTip").hide();
	$("#platNameModifyTip").html("");
	if(addOrModify == '11'){
		platName= $("#platNameAdd").val();
		if (platName=='') {
			$("#platNameAddTip").append("收银平台名称不能为空");
			$("#platNameAddTip").show();
			$("#platNameAdd").focus();
			return;
		}
    }
	if(addOrModify == '12'){
		platName= $("#platNameModify").val();
		if (platName=='') {
			$("#platNameModifyTip").append("收银平台名称不能为空");
			$("#platNameModifyTip").show();
			$("#platNameModify").focus();
			return;
		}
    }
	return true;
}
function addTipContent2(addOrModify){
	var callBackUrl= '';
	$("#callBackUrlAddTip").hide();
	$("#callBackUrlAddTip").html("");
	$("#callBackUrlModifyTip").hide();
	$("#callBackUrlModifyTip").html("");
	if(addOrModify == '11'){
		callBackUrl= $("#callBackUrlAdd").val();
		if (callBackUrl=='') {
			$("#callBackUrlAddTip").append("前台回调地址不能为空");
			$("#callBackUrlAddTip").show();
			//locationFocus("callBackUrlAdd");
			$("#callBackUrlAdd").focus();
			return;
		} 
    }
	if(addOrModify == '12'){
		callBackUrl= $("#callBackUrlModify").val();
		if (callBackUrl=='') {
			$("#callBackUrlModifyTip").append("前台回调地址不能为空");
			$("#callBackUrlModifyTip").show();
			//locationFocus("callBackUrlAdd");
			$("#callBackUrlModify").focus();
			return;
		} 
    }
	return true;
}
/* function addTipContent3(addOrModify){
	var notifyUrl= '';
	$("#notifyUrlAddTip").hide();
	$("#notifyUrlAddTip").html("");
	$("#notifyUrlModifyTip").hide();
	$("#notifyUrlModifyTip").html("");
	if(addOrModify == '11'){
		notifyUrl= $("#notifyUrlAdd").val();
		if (notifyUrl=='') {
			$("#notifyUrlAddTip").append("后台通知地址不能为空");
			$("#notifyUrlAddTip").show();
			//locationFocus("notifyUrlAdd");
			
			return;
		}
		$("#notifyUrlAdd").focus();
    }
	if(addOrModify == '12'){
		notifyUrl= $("#notifyUrlModify").val();
		if (notifyUrl=='') {
			$("#notifyUrlModifyTip").append("后台通知地址不能为空");
			$("#notifyUrlModifyTip").show();
			//locationFocus("notifyUrlAdd");
			
			return;
		}
		$("#notifyUrlModify").focus();
    }
	return true;
} */
function addTipContent4(addOrModify){
	var payGateWay = $("[name=payChannelId]:checkbox").serialize();
	var payGateWayModify = $("[name=payChannelIdModify]:checkbox").serialize();
	$("#payGateWayTip").hide();
	$("#payGateWayTip").html("");
	$("#payChannelIdModifyTip").hide();
	$("#payChannelIdModifyTip").html("");
	if(addOrModify == '11'){
		if (payGateWay=='') {
			$("#payGateWayTip").append("请至少选择一个支付网关！");
			$("#payGateWayTip").show();
			
			return;
		}
		$("#payChannelId").focus();
    }
	if(addOrModify == '12'){
		if (payGateWayModify=='') {
			$("#payChannelIdModifyTip").append("请至少选择一个支付网关！");
			$("#payChannelIdModifyTip").show();
			
			return;
		}
		$("#payChannelIdModify").focus();
    }
	return true;
}

function addTipContentBack(addOrModify){
	var platName= '';
	var callBackUrl= '';
	var notifyUrl= '';
	var payGateWay = $("[name=payChannelId]:checkbox").serialize();
	var payGateWayModify = $("[name=payChannelIdModify]:checkbox").serialize();
	$("#platNameAddTip").hide();
	$("#platNameAddTip").html("");
	$("#callBackUrlAddTip").hide();
	$("#callBackUrlAddTip").html("");
	$("#notifyUrlAddTip").hide();
	$("#notifyUrlAddTip").html("");
	$("#payGateWayTip").hide();
	$("#payGateWayTip").html("");
	if(addOrModify == '11'){
		platName= $("#platNameAdd").val();
		callBackUrl= $("#callBackUrlAdd").val();
		notifyUrl= $("#notifyUrlAdd").val();
		if (platName=='') {
			$("#platNameAddTip").append("收银平台名称不能为空");
			$("#platNameAddTip").show();
			$("#platNameAdd").focus();
			return;
		}
		if (callBackUrl=='') {
			$("#callBackUrlAddTip").append("前台回调地址不能为空");
			$("#callBackUrlAddTip").show();
			//locationFocus("callBackUrlAdd");
			$("#callBackUrlAdd").focus();
			return;
		} 
		if (notifyUrl=='') {
			$("#notifyUrlAddTip").append("后台通知地址不能为空");
			$("#notifyUrlAddTip").show();
			//locationFocus("notifyUrlAdd");
			$("#notifyUrlAdd").focus();
			return;
		}
		if (payGateWay=='') {
			$("#payGateWayTip").append("请至少选择一个支付网关！");
			$("#payGateWayTip").show();
			locationFocus("payChannelId");
			return;
		}
    }
}

//表格排序表头样式
$(document).ready(function(e) {
	loadResult();
});

</script>
</body>
</html>